import request from '@/utils/request'

// api地址
const api = {
	image: '/oms/yoshopOrderRefundImage/createImage',
	delete: '/oms/yoshopOrderRefundImage/deleteImage',
	avatar: '/ums/yoshopUser/createImage'
}

// 设置项详情
export const deleteImage = (data) => {
	return request.post(api.delete, data)
}

// 图片上传
export const image = files => {
	// 文件上传大小, 2M
	const maxSize = 1024 * 1024 * 10
	// 执行上传
	return new Promise((resolve, reject) => {
		request.urlFileUpload({
				files,
				maxSize
			})
			.then(result => resolve(result))
			.catch(reject)
	})
}
export const avatar = files => {
	// 文件上传大小, 2M
	const maxSize = 1024 * 1024 * 10
	// 执行上传
	return new Promise((resolve, reject) => {
		request.urlFileUpload({
				files,
				maxSize,
				url:api.avatar
			})
			.then(result => resolve(result))
			.catch(reject)
	})
}